<?php
namespace App\Traits;

trait ErrorTrait
{
    public function dataNotExits()
    {
        return ['code' => 1, 'msg' => 'data not exits'];
    }

    public function apiNotSucc($apiCode, $result)
    {
        return ['code' => 2, 'info' => 'api error ', 'msg' => $result];
    }

    public function codeOrPhoneNotExistError()
    {
        return ['result' => -998, 'msg' => '短信验证码错误或手机号码错误'];
    }

    public function redirectUserAdminSuccesss()
    {
        return ['result' => 100, 'msg' => '用户登录成功，跳转到用户中心'];
    }

    public function normalSuccess()
    {
        return ['result' => 0];
    }

    public function normalError()
    {
        return ['result' => -1];
    }

    public function userRegistError()
    {
        return ['result' => -2, 'msg' => '用户注册失败'];
    }

    public function companyNameSameError()
    {
        return ['result' => -997, 'msg' => '公司名称已经存在'];
    }

    public function emailPushSuccess()
    {
        return ['result' => 0, 'msg' => '邮件发送成功'];
    }

    public function emailPushFail()
    {
        return ['result' => -996, 'msg' => '邮件发送失败'];
    }
}
